home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / tctok.exe / OEMSETUP.INF < prev    next >
INI File  |  1994-03-03  |  57KB  |  1,286 lines

  1. ; ------------------------------------------------------------------------
  2. ; Microsoft Windows NT and Driver Installation
  3. ; Thomas-Conrad Token Ring Drivers
  4. ; Copyright 1993 Thomas-Conrad Corporation
  5. ; v1.00b3 (940303)
  6. ; ------------------------------------------------------------------------
  7. ; NOTES: To adapt this OEMSETNT.INF file for another flavor of adapter,
  8. ;        look for the 'NOTE: Adapter Adaptation area' comments.
  9. ;        The model for this installation calls for one .DLL,
  10. ;        one driver .SYS file, and one installation .INF file.  All are
  11. ;        copied during installation and deleted during removal.
  12. ;        To emit debug statements to the debugger, remove the comments 
  13. ;        in the first two statements in [InstallOption].  For documentation
  14. ;        on this script language, dialogs, whys, wherefores, and weirdies, 
  15. ;        look to  the 'NT Programmers Guide', chapters 2 and 4, 'ncpainf.doc' 
  16. ;        from the build 506 NT DDK, and 'setupddk.doc' from  the build 
  17. ;        506 NT DDK (neither made the release DDK for some reason).  
  18. ;        The only script language operator we use that's not documented 
  19. ;        anywhere is the 'tilde' (~), which returns  finds the index of 
  20. ;        a match within a list.
  21. ; ------------------------------------------------------------------------
  22.  
  23. [Source Media Descriptions]
  24.    1  = "Thomas-Conrad Token Ring Drivers Diskette",    TAGFILE = tctokwin
  25.  
  26. [Files-Driver]
  27.    1, tctoknt.sys,  SIZE=51712
  28.    1, eaglecaf.bin, SIZE=26880
  29.  
  30. [Files-Dll]
  31.    1, tctoknt.dll,  SIZE=8704
  32.  
  33. [OptListENG]
  34. ; -----------------------------------------------------------------------------
  35. ; This list supports multiple adapters of a similar type.
  36. ; Format is:  tag = option, irqs, selection , name, title, description
  37. ; tag          - tag required by script file, it's ignored for all intents...
  38. ; option       - an NCPA variable used to drive option selection
  39. ; selection    - displayed in 'Add Network Adapter' dialog box
  40. ; name         - base name for adapter in the registry
  41. ; title        - 'Installed Adapter Cards' item in the NCPA Network dialog box
  42. ; description  - 'Description' item in the NCPA Network dialog box
  43. ; -----------------------------------------------------------------------------
  44. ;  tag    = option,   selection,               name,     title,                       description
  45. ;
  46. OptList_1 = tc$4035e, "Thomas-Conrad TC4035",  "TCTOK",  "TC4035 Token Ring Adapter", "Thomas-Conrad 4Mbps Token Ring Adapter/AT"
  47. OptList_2 = tc$4045e, "Thomas-Conrad TC4045",  "TCTOK",  "TC4045 Token Ring Adapter", "Thomas-Conrad 16/4Mbps Token Ring Adapter/AT"
  48. OptList_3 = tc$4046e, "Thomas-Conrad TC4046",  "TCTOK",  "TC4046 Token Ring Adapter", "Thomas-Conrad 16/4Mbps Token Ring Adapter/MC"
  49.                           
  50. [FileConstants]
  51.    ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  52.    ; NOTE: Adapter Adaptation area
  53.    ; TccBaseName - base filename for .sys, .dll files, binding rules
  54.    ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  55.    Manufacturer             = "Thomas-Conrad"
  56.    TccBaseName              = "tctok"
  57.    SoftwareMajorVersion     = "1"
  58.    SoftwareMinorVersion     = "00s1"
  59.    InterruptTextList        = ^(InterruptChoices, 1)
  60.    InterruptValueList       = ^(InterruptChoices, 2)
  61.    IoBaseTextList           = ^(IoBaseChoices, 1)
  62.    IoBaseValueList          = ^(IoBaseChoices, 2)
  63.    DmaChannelTextList       = ^(DmaChannelChoices, 1)
  64.    DmaChannelValueList      = ^(DmaChannelChoices, 2)
  65.    SpeedTextList            = ^(SpeedChoices, 1)
  66.    SpeedValueList           = ^(SpeedChoices, 2)
  67.    SpeedRadioButtonIdxList  = ^(SpeedChoices, 3)
  68.    SlotNumberTextList       = ^(SlotNumberChoices, 1)
  69.    SlotNumberValueList      = ^(SlotNumberChoices, 2)
  70.    ; - - - - - - - - - - - - - - -
  71.    NetEventDLL              = "%SystemRoot%\System32\netevent.dll"
  72.    IoLogMsgDLL              = "%SystemRoot%\System32\IoLogMsg.dll"
  73.    UtilityInf               = "UTILITY.INF"
  74.    SubroutineInf            = "SUBROUTN.INF"
  75.    SoftwareType             = "driver"
  76.    Exit_Code                = 0
  77.    SoftwareVersion          = $(SoftwareMajorVersion)"."$(SoftwareMinorVersion)
  78.    SoftwareImage            = "\SystemRoot\System32\drivers\"$(TccBaseName)"nt.sys"
  79.    NetRuleSoftwareType      = $(TccBaseName)"Sys ndisDriver "$(TccBaseName)"Driver"
  80.    NetRuleSoftwareBindForm  = """"$(TccBaseName)"Sys"" yes no container"
  81.    NetRuleSoftwareBindable  = {""$(TccBaseName)"Driver "$(TccBaseName)"Adapter non exclusive 100"}
  82.    NetRuleSoftwareClass     = {""$(TccBaseName)"Driver basic"}
  83.    NetRuleSoftwareUse       = $(SoftwareType)
  84.    NetRuleHardwareType      = $(TccBaseName)" "$(TccBaseName)"Adapter"
  85.    NetRuleHardwareClass     = {""$(TccBaseName)"Adapter basic"}
  86.    NetRuleHardwareBindForm  = " yes yes container"
  87.    KeyName_SoftwareRoot     = $(!NTN_SoftwareBase)"\"$(Manufacturer)
  88.    KeyName_Software         = $(KeyName_SoftwareRoot)"\"$(TccBaseName)"\CurrentVersion"
  89.  
  90. [InterruptChoices]
  91.    Interrupt_1  = "2/9",  2
  92.    Interrupt_2  = "3"  ,  3
  93.    Interrupt_4  = "5"  ,  5
  94.    Interrupt_4  = "6"  ,  6
  95.    Interrupt_5  = "7"  ,  7
  96.    Interrupt_6  = "10" , 10
  97.    Interrupt_7  = "11" , 11
  98.    Interrupt_8  = "12" , 12
  99.                      
  100. [IoBaseChoices]  
  101.    IoBaseChoice_1 = "1A20", 6688
  102.    IoBaseChoice_2 = "2A20", 10784
  103.    IoBaseChoice_3 = "3A20", 14880
  104.    IoBaseChoice_4 = "3A40", 14912
  105.    IoBaseChoice_5 = "3A60", 14944
  106.    IoBaseChoice_6 = "3A80", 14976
  107.    IoBaseChoice_7 = "3AA0", 15008
  108.    IoBaseChoice_8 = "4AE0", 19168
  109.  
  110. [DmaChannelChoices]
  111.    DmaChannelChoice_1 = "5",        5
  112.    DmaChannelChoice_2 = "6",        6
  113.    DmaChannelChoice_3 = "7",        7
  114.    DmaChannelChoice_4 = "1",        1
  115.    DmaChannelChoice_5 = "Disabled", 0
  116.  
  117. [SpeedChoices]
  118.    SpeedChoice_1 = "4 Mbps",   4, 1
  119.    SpeedChoice_2 = "16 Mbps", 16, 2
  120.  
  121. [SlotNumberChoices]
  122.    SlotNumberChoice_1 = "Slot 1", 1
  123.    SlotNumberChoice_2 = "Slot 2", 2
  124.    SlotNumberChoice_3 = "Slot 3", 3
  125.    SlotNumberChoice_4 = "Slot 4", 4
  126.    SlotNumberChoice_5 = "Slot 5", 5
  127.    SlotNumberChoice_6 = "Slot 6", 6
  128.    SlotNumberChoice_7 = "Slot 7", 7
  129.    SlotNumberChoice_8 = "Slot 8", 8
  130.  
  131. [FileConstantsENG]
  132.    ProCaption              = "Windows NT Setup"
  133.    ProCancel               = "Cancel"
  134.    ProCancelMsg            = "Your Thomas-Conrad Windows NT Networking "+
  135.                              "Adapter is not correctly installed.  Are "+
  136.                              "you sure you want to cancel copying files?"
  137.    ProCancelCap            = "Network Setup Message"
  138.    ProText1                = "Copying:"
  139.    ProText2                = "To:"
  140.    ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  141.    ; NOTE: Adapter Adaptation area
  142.    ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  143.    ; SoftwareTitle        - Short name, displayed in NCPA dlg box in 
  144.    ;                        'Installed Network Software' window
  145.    ; SoftwareDescription  - Long name, Displayed in NCPA dlg box in 
  146.    ;                        'Description' window when software selected
  147.    ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  148.    SoftwareTitle              = "TCC Token Ring Driver"
  149.    SoftwareDescription        = "Thomas-Conrad Token Ring Driver"
  150.    ; - - - - - - - - - - - - - - -
  151.  
  152. [DialogConstantsENG]
  153.    ; - - - - - - - - - - - - - - -
  154.    ; NOTE: Adapter Adaptation area
  155.    ; - - - - - - - - - - - - - - -
  156.    Help                    = "&Help"
  157.    Exit                    = "Cancel"
  158.    OK                      = "OK"
  159.    HelpContext             = ""
  160.    Continue                = "Continue"
  161.    Cancel                  = "C&ancel"
  162.    ; - - - - - - - - - - - - - - -
  163.  
  164. [Basic4035DlgENG]
  165.    ; - - - - - - - - - - - - - - -
  166.    ; NOTE: Adapter Adaptation area
  167.    ; - - - - - - - - - - - - - - -
  168.    DlgType                 = "RadioCombination"
  169.    DlgTemplate             = "TCCTOK_4035"
  170.    EditFocusOn             = $(!IDC_COMBO1)
  171.    ReInit                  = NO
  172.    Caption                 = ""
  173.    Combo1List              = $(InterruptTextList)
  174.    Combo1Out               = $(InterruptTextDlgDefault)
  175.    Combo2List              = $(IoBaseTextList)
  176.    Combo2Out               = $(IoBaseTextDlgDefault)
  177.    Combo3List              = $(DmaChannelTextList)
  178.    Combo3Out               = $(DmaChannelTextDlgDefault)
  179.    ComboListItemsIn        = {Combo1List,Combo2List,Combo3List}
  180.    ComboListItemsOut       = {Combo1Out,Combo2Out,Combo3Out}
  181.    RadioIn                 = ""
  182. ;; since AdvancedDlgENG is using EditText, we can't...
  183.    EditTextIn              = ""
  184.    EditTextLim             = ""
  185.    NotifyFields            = {NO, NO, NO}
  186.    HelpContext             = ""
  187.    ; - - - - - - - - - - - - - - -
  188.  
  189.  
  190. [Basic4045DlgENG]
  191.    ; - - - - - - - - - - - - - - -
  192.    ; NOTE: Adapter Adaptation area
  193.    ; - - - - - - - - - - - - - - -
  194.    DlgType                 = "RadioCombination"
  195.    DlgTemplate             = "TCCTOK_4045"
  196.    EditFocusOn             = $(!IDC_COMBO1)
  197.    ReInit                  = NO
  198.    Caption                 = ""
  199.    Combo1List              = $(InterruptTextList)
  200.    Combo1Out               = $(InterruptTextDlgDefault)
  201.    Combo2List              = $(IoBaseTextList)
  202.    Combo2Out               = $(IoBaseTextDlgDefault)
  203.    Combo3List              = $(DmaChannelTextList)
  204.    Combo3Out               = $(DmaChannelTextDlgDefault)
  205.    ComboListItemsIn        = {Combo1List,Combo2List,Combo3List}
  206.    ComboListItemsOut       = {Combo1Out,Combo2Out,Combo3Out}
  207.    RadioIn                 = { $(SpeedIntDlgDefault) }
  208. ;; since AdvancedDlgENG is using EditText, we can't...
  209.    EditTextIn              = ""
  210.    EditTextLim             = ""
  211.    NotifyFields            = {NO, NO, NO}
  212.    HelpContext             = ""
  213.    ; - - - - - - - - - - - - - - -
  214.  
  215. [Basic4046DlgENG]
  216.    ; - - - - - - - - - - - - - - -
  217.    ; NOTE: Adapter Adaptation area
  218.    ; - - - - - - - - - - - - - - -
  219.    DlgType                 = "RadioCombination"
  220.    DlgTemplate             = "TCCTOK_4046"
  221.    EditFocusOn             = $(!IDC_COMBO1)
  222.    ReInit                  = NO
  223.    Caption                 = ""
  224.    Combo1List              = $(SlotNumberTextList)
  225.    Combo1Out               = $(SlotNumberTextDlgDefault)
  226.    ComboListItemsIn        = {Combo1List}
  227.    ComboListItemsOut       = {Combo1Out}
  228.    RadioIn                 = ""
  229. ;; since AdvancedDlgENG is using EditText, we can't...
  230.    EditTextIn              = ""
  231.    EditTextLim             = ""
  232.    NotifyFields            = {NO}
  233.    HelpContext             = ""
  234.    ; - - - - - - - - - - - - - - -
  235.  
  236. [AdvancedDlgENG]
  237.    ; - - - - - - - - - - - - - - -
  238.    ; NOTE: Adapter Adaptation area
  239.    ; - - - - - - - - - - - - - - -
  240.    DlgType                 = "RadioCombination"
  241.    DlgTemplate             = "TCCTOK_ADVANCED"
  242.    EditFocusOn             = $(IDC_EDIT1)
  243.    ReInit                  = NO
  244.    Caption                 = $(FunctionTitle)
  245. ;; since Basic4045DlgENG is using ComboList and Radio, we can't...   
  246. ;; ComboListItemsIn        = ""
  247. ;; ComboListItemsOut       = ""
  248. ;; RadioIn                 = ""
  249.    EditField1              = $(PacketSizeTextDlgDefault)
  250.    EditField2              = $(NetAddressTextDlgDefault)
  251.    EditField3              = $(ProductIdTextDlgDefault)
  252.    EditTextIn              = { $(EditField1), $(EditField2), $(EditField3) }
  253.    EditTextLim             = { 5, 17 36 }
  254.    NotifyFields            = ""
  255.    HelpContext             = ""
  256.    ; - - - - - - - - - - - - - - -
  257.  
  258. [Identify]
  259.    ; ----------------------------------------------------------------
  260.    ; Identify ourselves as an NT installation script file
  261.    ; and tell setup about us and our installation diskette
  262.    ; ----------------------------------------------------------------
  263.    set Status          = STATUS_SUCCESSFUL
  264.    set Identifier      = NetAdapter
  265.    set Media           = #("Source Media Descriptions", 1, 1)
  266.    Return $(Status) $(Identifier) $(Media)
  267.  
  268. [ReturnOptions]
  269.    ; ----------------------------------------------------------------
  270.    ; If we support the requested language, return the NCPA variable
  271.    ; list and its matching text list, so the user can select an
  272.    ; option to process
  273.    ; ----------------------------------------------------------------
  274.    set Status          = STATUS_FAILED
  275.    set OptionList      = {}
  276.    set OptionTextList  = {}
  277.    set LanguageList    = ^(LanguagesSupported, 1)
  278.    Ifcontains(i) $($0) in $(LanguageList)
  279.       ifstr(i) $($1) == ""
  280.          goto ReturnOptions_Set
  281.       endif
  282.       set PlatformList = ^(PlatformsSupported, 1)
  283.       Ifcontains(i) $($1) in $(PlatformList)
  284.          goto ReturnOptions_Set
  285.       else
  286.          set Status = STATUS_NOTSUPPORTED
  287.          goto ReturnOptions_Exit
  288.       endif
  289.    else
  290.       set Status = STATUS_NOLANGUAGE
  291.       goto ReturnOptions_Exit
  292.    endif
  293. ReturnOptions_Set = +
  294.     set OptionList      = ^(OptList$($0), 1)
  295.     set OptionTextList  = ^(OptList$($0), 2)
  296.     set Status          = STATUS_SUCCESSFUL
  297. ReturnOptions_Exit = +
  298.     Return $(Status) $(OptionList) $(OptionTextList)
  299.  
  300. [LanguagesSupported]
  301.    ENG
  302.  
  303. [GeneralConstants]
  304.    from                     = ""
  305.    to                       = ""
  306.    ExitCodeOk               = 0
  307.    ExitCodeCancel           = 1
  308.    ExitCodeFatal            = 2
  309.    Key_Null                 = ""
  310.    MAXIMUM_ALLOWED          = 33554432
  311.    RegistryErrorIndex       = NO_ERROR
  312.    Key_Product              = ""
  313.    Key_HardwareParameters   = ""
  314.    TRUE                     = 1
  315.    FALSE                    = 0
  316.    NoTitle                  = 0
  317.    ExitState                = "Active"
  318.    OldVersionExisted        = $(FALSE)
  319.    DriverPath               = $(!STF_NTPATH)\drivers
  320.                            
  321. [date]                     
  322.    Now                      = {} ? $(!LIBHANDLE) GetSystemDate
  323.  
  324. [ProductType]
  325.    STF_PRODUCT  = Winnt
  326.    STF_PLATFORM = I386
  327.  
  328. [PlatformsSupported]
  329.    ISA
  330.    EISA
  331.    MCA
  332.  
  333. [Install-Option]
  334.    Debug-Output "$(STF_CONTEXTINFNAME): Entering Install-Option"
  335.    set STF_VITAL = ""
  336.    ifstr(i) $(AddCopy) == "YES"
  337.       set STF_VITAL = "YES"
  338.       AddSectionFilesToCopyList Files-Driver $(SrcDir)ndis $(!STF_WINDOWSSYSPATH)\drivers
  339.       AddSectionFilesToCopyList Files-Dll $(SrcDir)ndis $(!STF_WINDOWSSYSPATH)
  340.    endif
  341.    ifstr(i) $(DoCopy) == "YES"
  342.       set STF_VITAL = "YES"
  343.       set !STF_NCPA_FLUSH_COPYLIST = TRUE
  344.       CopyFilesInCopyList
  345.    endif
  346.    ifstr(i) $(DoConfig) == "YES"
  347.    endif
  348.    exit
  349.  
  350. [Install-Update]
  351.    Debug-Output "$(STF_CONTEXTINFNAME): Entering Install-Update"
  352.    set STF_VITAL        = "YES"
  353.    set STF_OVERWRITE    = "VERIFYSOURCEOLDER"
  354.    AddSectionFilesToCopyList Files-Driver $(SrcDir)ndis $(!STF_WINDOWSSYSPATH)\drivers
  355.    AddSectionFilesToCopyList Files-Dll $(SrcDir)ndis $(!STF_WINDOWSSYSPATH)
  356.    set !STF_NCPA_FLUSH_COPYLIST = TRUE
  357.    CopyFilesInCopyList
  358.    exit
  359.  
  360. [Remove-Option]
  361.    Debug-Output "$(STF_CONTEXTINFNAME): Entering Remove-Option"
  362.    set RemoveList = {}
  363.    set RemoveList = >($(RemoveList), $(!STF_WINDOWSSYSPATH)"\drivers\"$(TccBaseName)"nt.sys")
  364.    set RemoveList = >($(RemoveList), $(!STF_WINDOWSSYSPATH)"\drivers\eaglecaf.bin")
  365.    set RemoveList = >($(RemoveList), $(!STF_WINDOWSSYSPATH)"\"$(TccBaseName)"nt.dll")
  366.    set RemoveList = >($(RemoveList), $(STF_CONTEXTINFNAME))
  367.    ForListDo $(RemoveList)
  368.       Debug-Output "Removing .$($)."
  369.       LibraryProcedure Status , $(!LIBHANDLE), DelFile $($)
  370.    EndForListDo
  371.    exit
  372.  
  373. [InstallOption]
  374. ;;   set !DebugOutputControl = 1
  375. ;;   set !STF_DISPLAYDEBUGOUTPUT = 1
  376.    set TccOption = $($1)
  377.    set SrcDir    = $($2)
  378.    set AddCopy   = $($3)
  379.    set DoCopy    = $($4)
  380.    set DoConfig  = $($5)
  381.    Debug-Output "$(STF_CONTEXTINFNAME): Entering InstallOption"
  382.    Debug-Output "$(STF_CONTEXTINFNAME): STF_CWDIR: .$(!STF_CWDIR)."
  383.    Debug-Output "$(STF_CONTEXTINFNAME): STF_LANGUAGE: .$(!STF_LANGUAGE)."
  384.    Debug-Output "$(STF_CONTEXTINFNAME): !NTN_RegBase .$(!NTN_RegBase)."
  385.    Debug-Output "$(STF_CONTEXTINFNAME): !NTN_SoftwareBase .$(!NTN_SoftwareBase)."
  386.    Debug-Output "$(STF_CONTEXTINFNAME): TccOption: .$(TccOption). SrcDir: .$(SrcDir)."
  387.    Debug-Output "$(STF_CONTEXTINFNAME): AddCopy: .$(AddCopy). DoCopy: .$(DoCopy). DoConfig: .$(DoConfig)."
  388.    set LanguageList = ^(LanguagesSupported, 1)
  389.    Ifcontains(i) $($0) NOT-IN $(LanguageList)
  390.       Return STATUS_NOLANGUAGE
  391.    endif
  392.    set-subst LF = "\n"
  393.    ; ----------------------------------------------------------------
  394.    ; Pick up the general constants and file constants
  395.    ; ----------------------------------------------------------------
  396.    read-syms GeneralConstants
  397.    read-syms FileConstants
  398.    ; ----------------------------------------------------------------
  399.    ; Pick up the variables for this option (as selected by user)
  400.    ; These would normally reside in FileConstants, but there's no
  401.    ; dynamic selection mechanism supported in a read-syms section.
  402.    ; ----------------------------------------------------------------
  403.    set OptionNameList           = ^(OptList$(!STF_LANGUAGE), 1 )
  404.    set OptionHdwrNameList       = ^(OptList$(!STF_LANGUAGE), 3 )
  405.    set OptionHdwrTitleList      = ^(OptList$(!STF_LANGUAGE), 4 )
  406.    set OptionHdwrDescList       = ^(OptList$(!STF_LANGUAGE), 5 )
  407.    set ProductHdwrName          = *($(OptionHdwrNameList),+
  408.                                   ~($(OptionNameList), $(TccOption)))
  409.    set ProductHdwrTitle         = *($(OptionHdwrTitleList),+
  410.                                   ~($(OptionNameList), $(TccOption)))
  411.    set ProductHdwrDesc          = *($(OptionHdwrDescList),+
  412.                                   ~($(OptionNameList), $(TccOption)))
  413.    Debug-Output "$(STF_CONTEXTINFNAME): ProductHdwrName .$(ProductHdwrName)."
  414.    Debug-Output "$(STF_CONTEXTINFNAME): ProductHdwrTitle .$(ProductHdwrTitle)."
  415.    Debug-Output "$(STF_CONTEXTINFNAME): ProductHdwrDesc .$(ProductHdwrDesc)."
  416.    read-syms DialogConstants$(!STF_LANGUAGE)
  417.    ifstr(i) $(!NTN_Origination) == "NCPA"
  418.       set Continue = "OK"
  419.    endif
  420.    read-syms FileConstants$(!STF_LANGUAGE)
  421.    detect date
  422.    set-title $(FunctionTitle)
  423.    set to   = InstallOptionDispatch
  424.    set from = InstallOptionDispatch
  425.    set CommonStatus = STATUS_SUCCESSFUL
  426.    EndWait
  427.  
  428. InstallOptionDispatch = +
  429.    Debug-Output "$(STF_CONTEXTINFNAME): Entering InstallOptionDispatch"
  430.    ; ----------------------------------------------------------------
  431.    ; Figure out which label we need to dispatch to and
  432.    ; what our error recovery 'features' will be
  433.    ; ----------------------------------------------------------------
  434.    Ifstr(i) $(!NTN_InstallMode) == deinstall
  435.       set StartLabel = RemoveAdapterFromRegistry
  436.    else-Ifstr(i) $(!NTN_InstallMode) == Update
  437.       set StartLabel = UpgradeSoftware
  438.    else-Ifstr(i) $(!NTN_InstallMode) == bind
  439.       set StartLabel = CheckAdapterBinding
  440.    else-Ifstr(i) $(!NTN_InstallMode) == configure
  441.       set StartLabel = GetAdapterConfigFromRegistry
  442.       ; ----------------------------------------------------------------
  443.       ; We're going to configure, disallow configuring the driver
  444.       ; ----------------------------------------------------------------
  445.       Ifstr(i) $(KeyName_Software) == $(!NTN_RegBase)
  446.          Debug-Output "$(STF_CONTEXTINFNAME): Cannot configure driver software."
  447.          Shell $(UtilityInf), RegistryErrorString, CANNOT_CONFIGURE_SOFTWARE
  448.          ifint $($ShellCode) != $(!SHELL_CODE_OK)
  449.             set ShellErrorSection = UtilityInf:RegistryErrorString
  450.             goto ShellCodeError
  451.          endif
  452.          set Error = $($R0)
  453.          set from = InstallOptionExit
  454.          set to = InstallOptionExit
  455.          goto SetNonFatalInfo
  456.       endif
  457.    else
  458.       set StartLabel = TestForExistingInstallation
  459.       set OEM_ABANDON_OPTIONS = {}
  460.       set OEM_ABANDON_SOFTWARE = FALSE
  461.       set OEM_ABANDON_ON = TRUE
  462.    endif
  463.    ; ----------------------------------------------------------------
  464.    ; Establish defaults for all configurable values
  465.    ; ----------------------------------------------------------------
  466.    ; - - - - - - - - - - - - - - -
  467.    ; NOTE: Adapter Adaptation area
  468.    ; - - - - - - - - - - - - - - -
  469.    set AdapterTypeValue       = 1
  470.    set DmaChannelValue        = *( $(DmaChannelValueList), 1 )
  471.    set InterruptValue         = *( $(InterruptValueList), 1 )
  472.    set IoBaseValue            = *( $(IoBaseValueList), 1 )
  473.    set McaPosIdValue          = 81
  474.    set NetAddressValue        = ""
  475.    set PacketSizeValue        = 16384
  476.    set ProductIdValue         = ""
  477.    set SlotNumberValue        = *( $(SlotNumberValueList), 1 )
  478.    set SpeedValue             = *( $(SpeedValueList), 2 )
  479.    ; - - - - - - - - - - - - - - -
  480.    ; ----------------------------------------------------------------
  481.    ; Set the from/to labels vars for error cases, and dispatch...
  482.    ; ----------------------------------------------------------------
  483.    set from                   = $(FatalError)
  484.    set to                     = $(FatalError)
  485.    goto $(StartLabel)
  486.  
  487. TestForExistingInstallation = +
  488.    ; ----------------------------------------------------------------
  489.    ; Test the registry for an existing installation.
  490.    ; ----------------------------------------------------------------
  491.    ; Try to open the registry key for the driver so we can determine
  492.    ; if a driver and adapter card are already installed.
  493.    ; ----------------------------------------------------------------
  494.    set OldVersionExisted = $(FALSE)
  495.    Debug-Output "$(STF_CONTEXTINFNAME): Entering TestForExistingInstallation"
  496.    OpenRegKey $(!REG_H_LOCAL) "" $(KeyName_Software) $(MAXIMUM_ALLOWED) Key_Product
  497.    Ifstr $(Key_Product) != $(Key_Null)
  498.       CloseRegKey $(Key_Product)
  499.       ; ----------------------------------------------------------------
  500.       ; Disallow multiple installs of the driver
  501.       ; ----------------------------------------------------------------
  502.       ifstr(i) $(!NTN_RegBase) == $(KeyName_Software)
  503.          Shell $(UtilityInf), VerExistedDlg, $(SoftwareTitle), $(SoftwareVersion)
  504.          ifint $($ShellCode) != $(!SHELL_CODE_OK)
  505.             set ShellErrorSection = UtilityInf:VerExistedDlg
  506.             goto ShellCodeError
  507.          endif
  508.          goto end
  509.       else
  510.          ; ----------------------------------------------------------------
  511.          ; Allow multiple installs of the netcard (with a warning)
  512.          ; ----------------------------------------------------------------
  513.          Shell $(UtilityInf), CardExistedDlg
  514.          ifint $($ShellCode) != $(!SHELL_CODE_OK)
  515.             set ShellErrorSection = UtilityInf:CardExistedDlg
  516.             goto ShellCodeError
  517.          endif
  518.          ifstr(i) $($R1) == "OK"
  519.             set OldVersionExisted = $(TRUE)
  520.          else
  521.             goto InstallOptionExit
  522.          endif
  523.       endif
  524.    endif
  525.  
  526. CopyAdapterFiles = +
  527.    ; ----------------------------------------------------------------
  528.    ; Copy the adapter files from the diskette.
  529.    ; ----------------------------------------------------------------
  530.    ; If we're already installed and it's configure mode, skip this
  531.    ; and go get the configuration from the user.
  532.    ; If we're not installed and it's install mode, and copy mode
  533.    ; is set, ask the user for the install diskette, then install the
  534.    ; option section (which has the .sys, .dll files enumerated).
  535.    ; Our OEMSETNT.INF file has already been copied to the system
  536.    ; directory and renamed to OEMNADx.inf.
  537.    ; ----------------------------------------------------------------
  538.    Debug-Output "$(STF_CONTEXTINFNAME): Entering CopyAdapterFiles"
  539.    ifint $(OldVersionExisted) == $(TRUE)
  540.       ifstr(i) $(!NTN_InstallMode) == configure
  541.          goto GetAdapterConfigFromUser
  542.       endif
  543.    endif
  544.    StartWait
  545.    ifint $(OldVersionExisted) == $(FALSE)
  546.       ifstr(i) $(!NTN_InstallMode) == "install"
  547.          Ifstr(i) $(DoCopy) == "YES"
  548.             Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
  549.             Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  550.                set ShellErrorSection = UtilityInf:DoAskSource
  551.                Goto ShellCodeError
  552.             Else-Ifstr(i) $($R0) == STATUS_FAILED
  553.                Shell $(UtilityInf) RegistryErrorString "ASK_SOURCE_FAIL"
  554.                ifint $($ShellCode) != $(!SHELL_CODE_OK)
  555.                   set ShellErrorSection = UtilityInf:RegistryErrorString
  556.                   goto ShellCodeError
  557.                endif
  558.                set Error = $($R0)
  559.                Goto FatalError
  560.             Else-Ifstr(i) $($R0) == STATUS_USERCANCEL
  561.                Goto ProcessSuccessExit
  562.             Endif
  563.             Set SrcDir = $($R1)
  564.          Endif
  565.          install "Install-Option"
  566.          ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  567.             Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE"
  568.             ifint $($ShellCode) != $(!SHELL_CODE_OK)
  569.                set ShellErrorSection = UtilityInf:RegistryErrorString
  570.                goto ShellCodeError
  571.             endif
  572.             set Error = $($R0)
  573.             goto FatalError
  574.          endif
  575.       endif
  576.    endif
  577.  
  578. GetAdapterConfigFromRegistry = +
  579.    ; ----------------------------------------------------------------
  580.    ; Get the existing adapter's configuration from the registry
  581.    ; ----------------------------------------------------------------
  582.    ; If we're install mode, there's no existing configuration, so
  583.    ; skip this and go ask the user for the configuration
  584.    ; ----------------------------------------------------------------
  585.    Debug-Output "$(STF_CONTEXTINFNAME): Entering GetAdapterConfigFromRegistry"
  586.    ifstr(i) $(!NTN_InstallMode) == "install"
  587.       goto GetAdapterConfigFromUser
  588.    else
  589.       ; ----------------------------------------------------------------
  590.       ; Ensure that we have an open product key
  591.       ; ----------------------------------------------------------------
  592.       Ifstr $(Key_Product) == $(Key_Null)
  593.          OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) Key_Product
  594.          Ifstr $(Key_Product) == $(Key_Null)
  595.             set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  596.             Debug-Output $(STF_CONTEXTINFNAME)": Cannot find component product key"
  597.             goto FatalRegistryError
  598.          Endif
  599.       Endif
  600.       ; ----------------------------------------------------------------
  601.       ; Find our netcard service key and open it
  602.       ; ----------------------------------------------------------------
  603.       Shell $(UtilityInf) FindService, $(Key_Product)
  604.       Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  605.          set ShellErrorSection = UtilityInf:FindService
  606.          Goto ShellCodeError
  607.       Endif
  608.       Ifstr(i) $($R0) != NO_ERROR
  609.          Debug-Output "$(STF_CONTEXTINFNAME): Utility:FindService error: $($R0)"
  610.          Goto FatalRegistryError
  611.       endif
  612.       set Key_HardwareParameters = $($R2)
  613.       ; ----------------------------------------------------------------
  614.       ; Close the service key and open our netcard parameters key
  615.       ; ----------------------------------------------------------------
  616.       CloseRegKey $($R1)
  617.       Ifstr $(Key_HardwareParameters) == $(Key_Null)
  618.          set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  619.          Debug-Output $(STF_CONTEXTINFNAME)": Cannot find component service"
  620.          goto FatalRegistryError
  621.       endif
  622.       set OldVersionExisted = $(TRUE)
  623.       set ValueName = ""
  624.       set ValueData = ""
  625.       set ValueStr  = ""
  626.       set ValueList = {}
  627.       ; ----------------------------------------------------------------
  628.       ; Walk the hardware service parameters value list and pick up
  629.       ; (and save off) any values we're interested in.
  630.       ; ----------------------------------------------------------------
  631.       EnumRegValue $(Key_HardwareParameters) ValueList
  632.       ForListDo $(ValueList)
  633.          set ValueItem = $($)
  634.          set ValueName = *($(ValueItem),1)
  635.          set ValueData = *($(ValueItem),4)
  636.          ; - - - - - - - - - - - - - - -
  637.          ; NOTE: Adapter Adaptation area
  638.          ; - - - - - - - - - - - - - - -
  639.          Ifstr(i) $(ValueName) == "AdapterType"
  640.             set AdapterTypeValue = $(ValueData)
  641.          else-Ifstr(i) $(ValueName) == "DmaChannel"
  642.             set DmaChannelValue  = $(ValueData)
  643.          else-Ifstr(i) $(ValueName) == "Interrupt"
  644.             set InterruptValue  = $(ValueData)
  645.          else-Ifstr(i) $(ValueName) == "IoBase"
  646.             set IoBaseValue  = $(ValueData)
  647.          else-Ifstr(i) $(ValueName) == "NetAddress"
  648.             set NetAddressValue  = $(ValueData)
  649.          else-Ifstr(i) $(ValueName) == "PacketSize"
  650.             set PacketSizeValue  = $(ValueData)
  651.          else-Ifstr(i) $(ValueName) == "ProductId"
  652.             set ProductIdValue  = $(ValueData)
  653.          else-Ifstr(i) $(ValueName) == "Speed"
  654.             set SpeedValue  = $(ValueData)
  655.          else-Ifstr(i) $(ValueName) == "SlotNumber"
  656.             set SlotNumberValue  = $(ValueData)
  657.          endif
  658.          ; - - - - - - - - - - - - - - -
  659.          Debug-Output "$(STF_CONTEXTINFNAME): $(ValueName) == .$(ValueData)."
  660.       EndForListDo
  661.    Endif
  662.  
  663. GetAdapterConfigFromUser = +
  664.    ; ----------------------------------------------------------------
  665.    ; Get/Confirm the adapter's configuration from/with the user
  666.    ; ----------------------------------------------------------------
  667.    ; Load our DLL so we can get to our dialog box, then render the 
  668.    ; current configurable values (that have been previously been set
  669.    ; to defaults or have had registry info plugged in) into textual 
  670.    ; defaults for the dialog box
  671.    ; ----------------------------------------------------------------
  672.    Debug-Output "$(STF_CONTEXTINFNAME): Entering GetAdapterConfigFromUser"
  673.    LoadLibrary $(Media) $(!STF_WINDOWSSYSPATH)\$(TccBaseName)nt.dll hLib
  674.    set from = GetAdapterConfigFromUser
  675. GetAdpCfgFromUserOuterLoop = +
  676.    Debug-Output "$(STF_CONTEXTINFNAME): Entering Basic..."
  677.    ; - - - - - - - - - - - - - - -
  678.    ; NOTE: Adapter Adaptation area
  679.    ; - - - - - - - - - - - - - - -
  680.    set InterruptTextDlgDefault   = *($(InterruptTextList),+
  681.                                    ~($(InterruptValueList), +
  682.                                      $(InterruptValue)))
  683.    set IoBaseTextDlgDefault      = *($(IoBaseTextList),+
  684.                                    ~($(IoBaseValueList), +
  685.                                      $(IoBaseValue)))
  686.    set DmaChannelTextDlgDefault  = *($(DmaChannelTextList),+
  687.                                    ~($(DmaChannelValueList), +
  688.                                      $(DmaChannelValue)))
  689.    set SlotNumberTextDlgDefault  = *($(SlotNumberTextList),+
  690.                                    ~($(SlotNumberValueList), +
  691.                                      $(SlotNumberValue)))
  692.    set SpeedIntDlgDefault        = *($(SpeedRadioButtonIdxList),+
  693.                                    ~($(SpeedValueList), +
  694.                                     $(SpeedValue)))
  695.    ; ----------------------------------------------------------------
  696.    ; Get the dialog strings for the appropriate dialog box,
  697.    ; and ask the user for the configuration.
  698.    ; ----------------------------------------------------------------
  699.    ifstr(i) $(TccOption) == "tc$4035e"
  700.       read-syms Basic4035Dlg$(!STF_LANGUAGE)
  701.    else-ifstr(i) $(TccOption) == "tc$4045e"
  702.          read-syms Basic4045Dlg$(!STF_LANGUAGE)
  703.       else
  704.          read-syms Basic4046Dlg$(!STF_LANGUAGE)
  705.       endif 
  706.    endif 
  707.    ui start "InputDlg" $(hLib)
  708.    ifstr(i) $(DLGEVENT) == "CONTINUE"
  709.       ; ----------------------------------------------------------------
  710.       ; The user accepted, render the returned textual values back into 
  711.       ; actual values.  For ISA, it's Interrupt, IoBase, and DmaChannel,
  712.       ; Slot will end up being zero.  For MCA, we're only interested 
  713.       ; in Slot, so Interrupt, IoBase, and DmaChannel will end up zero.
  714.       ; ----------------------------------------------------------------
  715.       set InterruptValue  = *($(InterruptValueList),+
  716.                             ~($(InterruptTextList),+
  717.                              $(Combo1Out)))
  718.       set IoBaseValue     = *($(IoBaseValueList),+
  719.                             ~($(IoBaseTextList),+
  720.                              $(Combo2Out)))
  721.       set DmaChannelValue = *($(DmaChannelValueList),+
  722.                             ~($(DmaChannelTextList),+
  723.                              $(Combo3Out)))
  724.       set SlotNumberValue = *($(SlotNumberValueList),+
  725.                             ~($(SlotNumberTextList),+
  726.                               $(Combo1Out)))
  727.       set SpeedValue      = *($(SpeedValueList),+
  728.                             ~($(SpeedRadioButtonIdxList),+
  729.                             *($(RadioOut),1)))
  730.       Debug-Output "$(STF_CONTEXTINFNAME): User Accepted Basic configuration as follows:"
  731.       Debug-Output "$(STF_CONTEXTINFNAME): InterruptValue   == .$(InterruptValue)."
  732.       Debug-Output "$(STF_CONTEXTINFNAME): IoBaseValue      == .$(IoBaseValue)."
  733.       Debug-Output "$(STF_CONTEXTINFNAME): DmaChannelValue  == .$(DmaChannelValue)."
  734.       Debug-Output "$(STF_CONTEXTINFNAME): SlotNumberValue  == .$(SlotNumberValue)."
  735.       Debug-Output "$(STF_CONTEXTINFNAME): SpeedValue       == .$(SpeedValue)."
  736.       ; - - - - - - - - - - - - - - -
  737.       ui pop 1
  738.       FreeLibrary $(hLib)
  739.  
  740.    else-ifstr(i) $(DLGEVENT) == "EXIT"
  741. GetAdapterAdvancedConfigFromUser = +
  742.       ; ----------------------------------------------------------------
  743.       ; This is a Klooge.  We're using the control ID for exit to get to
  744.       ; the advanced menu, but it beats rolling our own dialog code, eh?
  745.       ; ----------------------------------------------------------------
  746.       Debug-Output "$(STF_CONTEXTINFNAME): Entering Advanced..."
  747.       set PacketSizeTextDlgDefault  = $(PacketSizeValue)
  748.       set NetAddressTextDlgDefault  = $(NetAddressValue)
  749.       set ProductIdTextDlgDefault   = $(ProductIdValue)
  750.       read-syms AdvancedDlg$(!STF_LANGUAGE)
  751.       ui start "AdvancedDlg" $(hLib)
  752.       ifstr(i) $(DLGEVENT) == "CONTINUE"
  753.          set PacketSizeValue  = *($(EditTextOut),1)
  754.          set NetAddressValue  = *($(EditTextOut),2)
  755.          set ProductIdValue   = *($(EditTextOut),3)
  756.          Debug-Output "$(STF_CONTEXTINFNAME): User accepted Advanced configuration as follows:"
  757.          Debug-Output "$(STF_CONTEXTINFNAME): PacketSizeValue == .$(PacketSizeValue)."
  758.          Debug-Output "$(STF_CONTEXTINFNAME): NetAddressValue == .$(NetAddressValue)."
  759.          Debug-Output "$(STF_CONTEXTINFNAME): ProductIdValue  == .$(ProductIdValue)."
  760.       endif
  761.       ; ----------------------------------------------------------------
  762.       ; Done with advanced, remove our dialog and go back to the
  763.       ; earlier one (mca or isa, as appropriate)
  764.       ; ----------------------------------------------------------------
  765.       ui pop 1
  766.       goto GetAdpCfgFromUserOuterLoop
  767.  
  768.    else-ifstr(i) $(DLGEVENT) == "CANCEL"
  769.       ; ----------------------------------------------------------------
  770.       ; The user cancelled, exit
  771.       ; ----------------------------------------------------------------
  772.       Debug-Output "$(STF_CONTEXTINFNAME): Dialog DLGEVENT = .$(DLGEVENT).  Bye."
  773.       set CommonStatus = STATUS_USERCANCEL
  774.       ui pop 1
  775.       FreeLibrary $(hLib)
  776.       goto InstallOptionExit
  777.  
  778.    else
  779.       ; ----------------------------------------------------------------
  780.       ; The user did something we can't understand, exit
  781.       ; ----------------------------------------------------------------
  782.       Debug-Output "$(STF_CONTEXTINFNAME): Dialog DLGEVENT = .$(DLGEVENT).  Bye."
  783.       ui pop 1
  784.       FreeLibrary $(hLib)
  785.       goto InstallOptionExit
  786.  
  787.    endif
  788.  
  789. AddAdapterSoftwareToRegistry = +
  790.    ; ----------------------------------------------------------------
  791.    ; Add Adapter Software (Driver) information to the registry
  792.    ; ----------------------------------------------------------------
  793.    Ifstr(i) $(!NTN_InstallMode) == configure
  794.       goto AddAdapterConfigurationToRegistry
  795.    Endif
  796.    ifint $(OldVersionExisted) == $(TRUE)
  797.       goto AddAdapterHardwareToRegistry
  798.    Endif
  799.    ; ----------------------------------------------------------------
  800.    ; Add the Software Component (driver) to the registry.
  801.    ; This will create keys and values as follows:
  802.    ;
  803.    ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion
  804.    ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion:RefCount
  805.    ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion:ServiceName
  806.    ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion\NetRules
  807.    ; \SYSTEM\CurrentControlSet\$(TccBaseName)
  808.    ; \SYSTEM\CurrentControlSet\$(TccBaseName):DisplayName
  809.    ; \SYSTEM\CurrentControlSet\$(TccBaseName):ErrorControl
  810.    ; \SYSTEM\CurrentControlSet\$(TccBaseName):Group
  811.    ; \SYSTEM\CurrentControlSet\$(TccBaseName):ImagePath
  812.    ; \SYSTEM\CurrentControlSet\$(TccBaseName):Start
  813.    ; \SYSTEM\CurrentControlSet\$(TccBaseName):Type
  814.    ; \SYSTEM\CurrentControlSet\$(TccBaseName)\Linkage
  815.    ; \SYSTEM\CurrentControlSet\$(TccBaseName)\Linkage\Disabled
  816.    ; \SYSTEM\CurrentControlSet\$(TccBaseName)\Parameters
  817.    ; \SYSTEM\CurrentControlSet\$(TccBaseName)\Security
  818.    ; \SYSTEM\CurrentControlSet\$(TccBaseName)\Security:Security
  819.    ; ----------------------------------------------------------------
  820.    Shell $(UtilityInf), +
  821.          AddSoftwareComponent, +
  822.          $(Manufacturer), +
  823.          $(TccBaseName), +
  824.          $(TccBaseName), +
  825.          $(SoftwareTitle), +
  826.          $(STF_CONTEXTINFNAME), +
  827.          $(SoftwareImage), +
  828.          "kernel", "NDIS", {}, "",+
  829.          $(NetEventDLL)
  830.    Set OEM_ABANDON_SOFTWARE = TRUE
  831.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  832.       set ShellErrorSection = UtilityInf:AddSoftwareComponent
  833.       goto ShellCodeError
  834.    endif
  835.    set RegistryErrorIndex = $($R0)
  836.    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  837.       EndWait
  838.       Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterSoftware - add component error"
  839.       CloseRegKey $($R1)
  840.       CloseRegKey $($R2)
  841.       CloseRegKey $($R3)
  842.       CloseRegKey $($R4)
  843.       CloseRegKey $($R5)
  844.       goto FatalRegistryError
  845.    endif
  846.    ; ----------------------------------------------------------------
  847.    ; Save the keys we'll use later and close the unused ones
  848.    ; ----------------------------------------------------------------
  849.    Set Key_SoftwareProduct    = $($R1)
  850.    Set Key_SoftwareNetRules   = $($R2)
  851.    CloseRegKey $($R3)
  852.    CloseRegKey $($R4)
  853.    CloseRegKey $($R5)
  854.    ; ----------------------------------------------------------------
  855.    ; Add the Software Product Information values to the registry key
  856.    ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion
  857.    ; ----------------------------------------------------------------
  858.    set NewValueList = {+
  859.        {SoftwareType, $(NoTitle), $(!REG_VT_SZ),    $(SoftwareType)},+
  860.        {MajorVersion, $(NoTitle), $(!REG_VT_DWORD), $(SoftwareMajorVersion)},+
  861.        {MinorVersion, $(NoTitle), $(!REG_VT_DWORD), $(SoftwareMinorVersion)},+
  862.        {Title,        $(NoTitle), $(!REG_VT_SZ),    $(SoftwareTitle)},+
  863.        {Description,  $(NoTitle), $(!REG_VT_SZ),    $(SoftwareDescription)},+
  864.        {ServiceName,  $(NoTitle), $(!REG_VT_SZ),    $(TccBaseName)},+
  865.        {InstallDate,  $(NoTitle), $(!REG_VT_DWORD), *($(Now),1)}+
  866.        }
  867.    Shell  $(UtilityInf), AddValueList, $(Key_SoftwareProduct), $(NewValueList)
  868.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  869.       set ShellErrorSection = UtilityInf:AddValueList
  870.       goto ShellCodeError
  871.    endif
  872.    Set RegistryErrorIndex = $($R0)
  873.    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  874.       EndWait
  875.       Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterSoftware - add value list error"
  876.       CloseRegKey $(Key_SoftwareProduct)
  877.       CloseRegKey $(Key_SoftwareNetRules)
  878.       goto FatalRegistryError
  879.    endif
  880.    ; ----------------------------------------------------------------
  881.    ; Add the Software Product Net Rules values to the registry key
  882.    ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion\NetRules
  883.    ; ----------------------------------------------------------------
  884.    Set NewValueList = {+
  885.        {type,      $(NoTitle), $(!REG_VT_SZ),       $(NetRuleSoftwareType)},+
  886.        {use,       $(NoTitle), $(!REG_VT_SZ),       $(NetRuleSoftwareUse)}, +
  887.        {bindform,  $(NoTitle), $(!REG_VT_SZ),       $(NetRuleSoftwareBindForm)}, +
  888.        {class,     $(NoTitle), $(!REG_VT_MULTI_SZ), $(NetRuleSoftwareClass)}, +
  889.        {bindable,  $(NoTitle), $(!REG_VT_MULTI_SZ), $(NetRuleSoftwareBindable)}, +
  890.        {InfOption, $(NoTitle), $(!REG_VT_SZ),       $(TccOption)}+
  891.        }
  892.    Shell  $(UtilityInf), AddValueList, $(Key_SoftwareNetRules), $(NewValueList)
  893.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  894.       set ShellErrorSection = UtilityInf:AddValueList
  895.       goto ShellCodeError
  896.    endif
  897.    Set RegistryErrorIndex = $($R0)
  898.    CloseRegKey $(Key_SoftwareProduct)
  899.    CloseRegKey $(Key_SoftwareNetRules)
  900.    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  901.       EndWait
  902.       Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterSoftware - add NetRule error"
  903.       goto FatalRegistryError
  904.    endif
  905.  
  906. AddAdapterHardwareToRegistry = +
  907.    ; ----------------------------------------------------------------
  908.    ; Add the Hardware Component (net card) the registry
  909.    ; This will create keys and values as follows:
  910.    ;
  911.    ; \SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\...
  912.    ;     ...\$(AdapterNumber)
  913.    ;     ...\$(AdapterNumber)\NetRules
  914.    ; \SYSTEM\CurrentControlSet\Services\...
  915.    ;     ...\$(ProductHdwrName)$(AdapterNumber)
  916.    ;     ...\$(ProductHdwrName)$(AdapterNumber)\Linkage
  917.    ;     ...\$(ProductHdwrName)$(AdapterNumber)\Linkage\Disabled
  918.    ; ----------------------------------------------------------------
  919.    Shell $(UtilityInf), +
  920.          AddHardwareComponent, +
  921.          $(ProductHdwrName), +
  922.          $(STF_CONTEXTINFNAME), +
  923.          $(KeyName_Software)
  924.    ifint $($R4) != -1
  925.       Set OEM_ABANDON_OPTIONS = >($(OEM_ABANDON_OPTIONS), $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards\"$($R4))
  926.    endif
  927.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  928.       set ShellErrorSection = UtilityInf:AddHardwareComponent
  929.       goto ShellCodeError
  930.    endif
  931.    set RegistryErrorIndex = $($R0)
  932.    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  933.       EndWait
  934.       Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterHardware - add component error"
  935.       CloseRegKey $($R1)
  936.       CloseRegKey $($R2)
  937.       CloseRegKey $($R3)
  938.       goto FatalRegistryError
  939.    endif
  940.    set Key_HardwareNetRules   = $($R2)
  941.    set Key_HardwareParameters = $($R3)
  942.    set AdapterNumber          = $($R4)
  943.    ; ----------------------------------------------------------------
  944.    ; Add the Hardware Product Information to the registry key
  945.    ; \SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\...
  946.    ;     ...\$(AdapterNumber)
  947.    ; ----------------------------------------------------------------
  948.    set NewValueList = {+
  949.        {Manufacturer, $(NoTitle), $(!REG_VT_SZ),    $(Manufacturer)},+
  950.        {Title,        $(NoTitle), $(!REG_VT_SZ),    "["$($R4)"] "$(ProductHdwrTitle)},+
  951.        {Description,  $(NoTitle), $(!REG_VT_SZ),    $(ProductHdwrDesc)},+
  952.        {ProductName,  $(NoTitle), $(!REG_VT_SZ),    $(ProductHdwrName)},+
  953.        {ServiceName,  $(NoTitle), $(!REG_VT_SZ),    $($R5)},+
  954.        {InstallDate,  $(NoTitle), $(!REG_VT_DWORD), *($(Now),1)}+
  955.        }
  956.    Shell $(UtilityInf), AddValueList, $($R1),  $(NewValueList)
  957.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  958.       set ShellErrorSection = UtilityInf:AddValueList
  959.       goto ShellCodeError
  960.    endif
  961.    CloseRegKey $($R1)
  962.    set TempProdName = """"$(ProductHdwrName)$(AdapterNumber)""""
  963.    set TempBindForm = $(TempProdName)$(NetRuleHardwareBindForm)
  964.    ; ----------------------------------------------------------------
  965.    ; Add the Hardware Net Rules to the registry key
  966.    ; \SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\...
  967.    ;     ...\$(AdapterNumber)\NetRules
  968.    ; ----------------------------------------------------------------
  969.    set NewValueList = {+
  970.        {type,      $(NoTitle), $(!REG_VT_SZ),       $(NetRuleHardwareType)},+
  971.        {bindform,  $(NoTitle), $(!REG_VT_SZ),       $(TempBindForm)}, +
  972.        {class,     $(NoTitle), $(!REG_VT_MULTI_SZ), $(NetRuleHardwareClass)}, +
  973.        {InfOption, $(NoTitle), $(!REG_VT_SZ),       $(TccOption)}+
  974.        }
  975.    Shell  $(UtilityInf), AddValueList, $(Key_HardwareNetRules), $(NewValueList)
  976.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  977.       set ShellErrorSection = UtilityInf:AddValueList
  978.       goto ShellCodeError
  979.    endif
  980.    set RegistryErrorIndex = $($R0)
  981.    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  982.       EndWait
  983.       Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterHardware - add NetRule error"
  984.       CloseRegKey $(Key_HardwareParameters)
  985.       CloseRegKey $(Key_HardwareNetRules)
  986.       goto FatalRegistryError
  987.    endif
  988.    CloseRegKey $(Key_HardwareNetRules)
  989.    goto AddAdapterConfigurationToRegistry
  990.  
  991. AddAdapterConfigurationToRegistry = +
  992.    Debug-Output "$(STF_CONTEXTINFNAME): Entering AddAdapterConfigurationToRegistry"
  993.    Shell $(UtilityInf), GetBusTypeNum
  994.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  995.       set ShellErrorSection = UtilityInf:GetBusTypeNum
  996.       goto ShellCodeError
  997.    endif
  998.    set BusTypeValue = $($R1)
  999.    ; ----------------------------------------------------------------
  1000.    ; Add the Hardware configuration information to the registry key
  1001.    ; \SYSTEM\CurrentControlSet\Services\$(ProductHdwrName)$(AdapterNumber)
  1002.    ; ----------------------------------------------------------------
  1003.    ; - - - - - - - - - - - - - - -
  1004.    ; NOTE: Adapter Adaptation area
  1005.    ; - - - - - - - - - - - - - - -
  1006.    ifstr(i) $(TccOption) == "tc$4046e"
  1007.       set NewValueList = {+
  1008.           {AdapterType,    $(NoTitle), $(!REG_VT_DWORD), $(AdapterTypeValue)},+
  1009.           {BusType,        $(NoTitle), $(!REG_VT_DWORD), $(BusTypeValue)},+
  1010.           {McaPosId,       $(NoTitle), $(!REG_VT_DWORD), $(McaPosIdValue)},+
  1011.           {NetAddress,     $(NoTitle), $(!REG_VT_SZ),    $(NetAddressValue)},+
  1012.           {PacketSize,     $(NoTitle), $(!REG_VT_DWORD), $(PacketSizeValue)},+
  1013.           {ProductId,      $(NoTitle), $(!REG_VT_SZ),    $(ProductIdValue)},+
  1014.           {SlotNumber,     $(NoTitle), $(!REG_VT_DWORD), $(SlotNumberValue)},+
  1015.           {Speed,          $(NoTitle), $(!REG_VT_DWORD), $(SpeedValue)}+
  1016.           }
  1017.    else
  1018.       set NewValueList = {+
  1019.           {AdapterType,    $(NoTitle), $(!REG_VT_DWORD), $(AdapterTypeValue)},+
  1020.           {BusType,        $(NoTitle), $(!REG_VT_DWORD), $(BusTypeValue)},+
  1021.           {DmaChannel,     $(NoTitle), $(!REG_VT_DWORD), $(DmaChannelValue)},+
  1022.           {Interrupt,      $(NoTitle), $(!REG_VT_DWORD), $(InterruptValue)},+
  1023.           {IoBase,         $(NoTitle), $(!REG_VT_DWORD), $(IoBaseValue)},+
  1024.           {NetAddress,     $(NoTitle), $(!REG_VT_SZ),    $(NetAddressValue)},+
  1025.           {PacketSize,     $(NoTitle), $(!REG_VT_DWORD), $(PacketSizeValue)},+
  1026.           {ProductId,      $(NoTitle), $(!REG_VT_SZ),    $(ProductIdValue)},+
  1027.           {Speed,          $(NoTitle), $(!REG_VT_DWORD), $(SpeedValue)}+
  1028.           }
  1029.    endif
  1030.    ; - - - - - - - - - - - - - - -
  1031.    Shell  $(UtilityInf), AddValueList, $(Key_HardwareParameters), $(NewValueList)
  1032.    CloseRegKey $(Key_HardwareParameters)
  1033.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1034.       set ShellErrorSection = UtilityInf:AddValueList
  1035.       goto ShellCodeError
  1036.    endif
  1037.    set RegistryErrorIndex = $($R0)
  1038.    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1039.       Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterConfiguration - add value list error"
  1040.       goto FatalRegistryError
  1041.    endif
  1042.    EndWait
  1043.    goto ProcessSuccessExit
  1044.  
  1045. CheckAdapterBinding =+
  1046.    Debug-Output "$(STF_CONTEXTINFNAME): Entering CheckAdapterBinding"
  1047.    set Error = "CheckAdapterBinding: not required for this adapter"
  1048.    goto FatalError
  1049.  
  1050. RemoveAdapterFromRegistry = +
  1051.    ; ----------------------------------------------------------------
  1052.    ; Remove the adapter by removing the hardware component.
  1053.    ; ----------------------------------------------------------------
  1054.    ; When the registry reference count reaches zero, the software
  1055.    ; component will automatically be removed.  If the last adapter
  1056.    ; is being removed from the registry, delete the associated
  1057.    ; file as well.  Lastly, remove the \SOFTWARE\$(Manufacturer) key
  1058.    ; if it's empty.
  1059.    ; ----------------------------------------------------------------
  1060.    Debug-Output "$(STF_CONTEXTINFNAME): Entering RemoveAdapterFromRegistry"
  1061.    OpenRegKey $(!REG_H_LOCAL) "" $(KeyName_Software) $(MAXIMUM_ALLOWED) KeyToReferenceCount
  1062.    Ifstr $(KeyToReferenceCount) == ""
  1063.       Debug-Output "$(STF_CONTEXTINFNAME): Could not open Software Base Key"
  1064.       set RefCountBeforeRemove = 2
  1065.       goto InstallOptionExit
  1066.    endif
  1067.    GetRegValue $(KeyToReferenceCount),"RefCount", RefCountInfo
  1068.    set RefCountBeforeRemove = *($(RefCountInfo), 4)
  1069.    CloseRegKey $(KeyToReferenceCount)
  1070.    Debug-Output "$(STF_CONTEXTINFNAME): Removing Hardware Component"
  1071.    Shell $(UtilityInf), +
  1072.          RemoveHardwareComponent, +
  1073.          $(Manufacturer), +
  1074.          $(TccBaseName), +
  1075.          $(!NTN_RegBase)
  1076.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1077.       set ShellErrorSection = UtilityInf:RemoveHardwareComponent
  1078.       goto ShellCodeError
  1079.    endif
  1080.    Ifstr(i) $($R0) != NO_ERROR
  1081.       Ifstr(i) $($R0) != REF_COUNT_NOT_ZERO
  1082.          goto FatalRegistryError
  1083.       endif
  1084.    endif
  1085.    ifint $(RefCountBeforeRemove) == 1
  1086.       OpenRegKey $(!REG_H_LOCAL) "" $(KeyName_SoftwareRoot) $(MAXIMUM_ALLOWED) Key_SoftwareRoot
  1087.       EnumRegKey $(Key_SoftwareRoot) KeyList
  1088.       EnumRegValue $(Key_SoftwareRoot) ValueList
  1089.       CloseRegKey $(Key_SoftwareRoot)
  1090.       ifstr $(KeyList) == "{}"
  1091.          ifstr $(ValueList) == "{}"
  1092.             OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase) $(MAXIMUM_ALLOWED) Key_SoftwareBase
  1093.             Debug-Output "$(STF_CONTEXTINFNAME): Deleting Registry Key .$(Key_SoftwareBase).\.$(Manufacturer)."
  1094.             DeleteRegKey $(Key_SoftwareBase) $(Manufacturer)
  1095.             CloseRegKey $(Key_SoftwareBase)
  1096.          endif
  1097.       endif
  1098.       install Remove-Option
  1099.    endif
  1100.    goto InstallOptionExit
  1101.  
  1102. UpgradeSoftware = +
  1103.    Debug-Output "$(STF_CONTEXTINFNAME): Entering UpgradeSoftware"
  1104.    ifstr(i) $(KeyName_Software) == $(!NTN_RegBase)
  1105.       OpenRegKey $(!REG_H_LOCAL) "" $(KeyName_Software) $(MAXIMUM_ALLOWED) Key_Product
  1106.       Ifstr $(Key_Product) != $(Key_Null)
  1107.          GetRegValue $(Key_Product),"MajorVersion", VersionInfo
  1108.          set Version = *($(VersionInfo), 4)
  1109.          Shell $(UtilityInf), GetInfFileNameFromRegistry, $(Key_Product)
  1110.          ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1111.             set ShellErrorSection = UtilityInf:GetFileNameFromRegistry
  1112.             goto ShellCodeError
  1113.          endif
  1114.          set !UG_Filename = $($R0)
  1115.          ifstr(i) $(!UG_Filename) != ""
  1116.             install "Install-Update"
  1117.             ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  1118.                goto FatalError
  1119.             endif
  1120.          endif
  1121.          SetRegValue $(Key_Product) {MajorVersion, $(NoTitle), $(!REG_VT_SZ), $(SoftwareMajorVersion)}
  1122.          SetRegValue $(Key_Product) {MinorVersion, $(NoTitle), $(!REG_VT_SZ), $(SoftwareMinorVersion)}
  1123.          ifint $(Version) != $(SoftwareVersion)
  1124.             Debug-Output "$(STF_CONTEXTINFNAME): Version .$(Version). != SoftwareVersion .$(SoftwareVersion)."
  1125.          endif
  1126.          CloseRegKey $(Key_Product)
  1127.       else
  1128.          goto FatalRegistryError
  1129.       endif
  1130.    else
  1131.       OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) NetworkCardKey
  1132.       Ifstr(i) $(NetworkCardKey) != $(Key_Null)
  1133.          GetRegValue $(NetworkCardKey),"ServiceName", ServiceNameInfo
  1134.          set ServiceName = *($(ServiceNameInfo), 4)
  1135.          OpenRegKey $(NetworkCardKey) "" "NetRules" $(MAXIMUM_ALLOWED) NetRuleKey
  1136.          Ifstr(i) $(NetRuleKey) != $(Key_Null)
  1137.             Debug-Output "$(STF_CONTEXTINFNAME): NetRuleKey .$(NetRuleKey). != Key_Null .$(Key_Null)."
  1138.          else
  1139.             goto FatalRegistryError
  1140.          endif
  1141.          CloseRegKey $(NetRules)
  1142.          CloseRegKey $(NetworkCardKey)
  1143.       else
  1144.          goto FatalRegistryError
  1145.       endif
  1146.       OpenRegKey $(!REG_H_LOCAL) +
  1147.                  "" $(!NTN_ServiceBase)"\"$(ServiceName) +
  1148.                  $(MAXIMUM_ALLOWED) +
  1149.                  ServiceKey
  1150.       Ifstr(i) $(ServiceKey) != $(Key_Null)
  1151.          CloseRegKey $(ServiceKey)
  1152.       else
  1153.          goto FatalRegistryError
  1154.       endif
  1155.    endif
  1156.    goto InstallOptionExit
  1157.  
  1158. ProcessSuccessExit = +
  1159.    goto InstallOptionExit
  1160.  
  1161. ProcessAbandonInstall = +
  1162.    ForListDo $(OEM_ABANDON_OPTIONS)
  1163.       Shell $(UtilityInf), +
  1164.             RemoveHardwareComponent, +
  1165.             $(Manufacturer), +
  1166.             $(TccBaseName), +
  1167.             $($)
  1168.       ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1169.          set ShellErrorSection = UtilityInf:RemoveHardwareComponent
  1170.          goto ShellCodeError
  1171.       endif
  1172.       set RegistryErrorIndex = $($R0)
  1173.       Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1174.          goto FatalRegistryError
  1175.       endif
  1176.    EndForListDo
  1177.    Ifstr(i) $(OEM_ABANDON_SOFTWARE) == TRUE
  1178.       Shell $(UtilityInf), +
  1179.             RemoveSoftwareComponent, +
  1180.             $(Manufacturer), +
  1181.             $(TccBaseName), +
  1182.             FALSE
  1183.       ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1184.          set ShellErrorSection = UtilityInf:RemoveSoftwareComponent
  1185.          goto ShellCodeError
  1186.       endif
  1187.       set RegistryErrorIndex = $($R0)
  1188.       Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1189.          goto FatalRegistryError
  1190.       endif
  1191.    endif
  1192.    goto InstallOptionExit
  1193.  
  1194. ProcessWarningMessage = +
  1195.    Shell $(SubroutineInf) SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error)
  1196.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1197.       set ShellErrorSection = SubroutineInf:SetupMessage
  1198.       goto ShellCodeError
  1199.    endif
  1200.    ifstr(i) $($R1) == "OK"
  1201.       goto $(to)
  1202.    else-ifstr(i) $($R1) == "CANCEL"
  1203.       goto $(from)
  1204.    else
  1205.       goto "InstallOptionExit"
  1206.    endif
  1207.  
  1208. SetNonFatalInfo = +
  1209.    Set CommonStatus = STATUS_USERCANCEL
  1210.    Set Severity = STATUS
  1211.    goto ProcessNonFatalMessage
  1212.  
  1213. ProcessNonFatalMessage = +
  1214.    ifstr(i) $(Error) == ""
  1215.       Set Severity = NONFATAL
  1216.       Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  1217.       ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1218.          set ShellErrorSection = UtilityInf:RegistryErrorString
  1219.          goto ShellCodeError
  1220.       endif
  1221.       set Error = $($R0)
  1222.    endif
  1223.    Shell $(SubroutineInf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
  1224.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1225.       set ShellErrorSection = SubroutineInf:SetupMessage
  1226.       goto ShellCodeError
  1227.    endif
  1228.    ifstr(i) $($R1) == "OK"
  1229.       goto $(from)
  1230.    else
  1231.       goto "InstallOptionExit"
  1232.    endif
  1233.  
  1234. FatalRegistryError = +
  1235.    Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
  1236.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1237.       set ShellErrorSection = UtilityInf:RegistryErrorString
  1238.       goto ShellCodeError
  1239.    endif
  1240.    set Error = $($R0)
  1241.    goto FatalError
  1242.  
  1243. FatalError = +
  1244.    ifstr(i) $(Error) == ""
  1245.       Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  1246.       ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1247.          set ShellErrorSection = UtilityInf:RegistryErrorString
  1248.          goto ShellCodeError
  1249.       endif
  1250.       set Error = $($R0)
  1251.    endif
  1252.    Shell $(SubroutineInf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
  1253.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1254.       set ShellErrorSection = UtilityInf:SetupMessage
  1255.       goto ShellCodeError
  1256.    endif
  1257.    goto SetFailedStatusAndExit
  1258.  
  1259. ShellCodeError = +
  1260.    Debug-Output $(STF_CONTEXTINFNAME)": Shell error, $(ShellErrorSection)"
  1261.    set DlgType      = "MessageBox"
  1262.    set STF_MB_TITLE = "Error: "$(FunctionTitle)
  1263.    set STF_MB_TEXT  = "Shell Code Error"
  1264.    set STF_MB_TYPE  = 1
  1265.    set STF_MB_ICON  = 3
  1266.    set STF_MB_DEF   = 1
  1267.    ui start "Error Message"
  1268.    goto SetFailedStatusAndExit
  1269.  
  1270. SetFailedStatusAndExit = +
  1271.    set CommonStatus = STATUS_FAILED
  1272.    ifstr(i) $(OEM_ABANDON_ON) == TRUE
  1273.       set OEM_ABANDON_ON = FALSE
  1274.       goto ProcessAbandonInstall
  1275.    endif
  1276.    goto InstallOptionExit
  1277.  
  1278. InstallOptionExit = +
  1279.    Return $(CommonStatus)
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.